package chapter06


import scala.beans.BeanProperty

/**
  * @Copyright: Shanghai Definesys Company.All rights reserved.
  * @Description:
  * @author: chuhaitao
  * @since: 2019/1/7 20:59
  * @history:
  *          1.2019/1/7 created by chuhaitao
  */
object Test extends App {
  //重命名，并将java的map元素映射到scalamap中
  import java.util.{HashMap => JavaHashMap}
  import collection.mutable.{HashMap => ScalaHashMap, Map => ScalaMap}

  var javaMap = new JavaHashMap[Int, String]

  javaMap.put(1, "1221");
  javaMap.put(2, "1221");
  javaMap.put(3, "1221");
  javaMap.put(4, "1221");

  //<> [] 泛型
  var scalaMap = new ScalaHashMap[Int, String]

  for (key <- javaMap.keySet().toArray) {
    //(key.asInstanceOf[Int] -> javaMap.get(key))  可以认为是一对元祖
    scalaMap += (key.asInstanceOf[Int] -> javaMap.get(key))

  }

  println(scalaMap)
}

class Student {

  @BeanProperty var name: String = _
  @BeanProperty var age: Int = _

}